<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <f:event type="preRenderView" listener="#{makerControllerBean.getItems}"></f:event>
    <h:head>
        <title>商品</title>
        <link href="../css/common.css" rel="stylesheet" type="text/css"></link>
        <link href="../css/input.css" rel="stylesheet" type="text/css"></link>
        <link href="../css/edit.css" rel="stylesheet" type="text/css"></link>
        <link href="../css/list.css" rel="stylesheet" type="text/css"></link>
    </h:head>
    <h:body>
        <ui:composition template="/WEB-INF/templates/horizontal_menu.xhtml">
            <ui:param name="activeIndex" value="3" />
        </ui:composition>
        <div class ="error">
            <p:messages /> 
        </div>
        <h:form enctype="multipart/form-data">
            <div id="header"></div>
            <div id="main-area">
                <div id="main-title">
                    <p:breadCrumb>
                        <p:menuitem value="ホーム" url="index.jsf"></p:menuitem>
                        <p:menuitem value="新規商品作成" url="#"/>
                    </p:breadCrumb>
                    <p:spacer height = "20px"></p:spacer>

                    <a href="index.jsf">戻る</a>
                </div>
                <div id="main-contents">
                    <p:panelGrid columns="2">
                        <f:facet name="header">  
                            商品情報 
                        </f:facet>
                        <h:outputLabel for="name" value="商品名 *" />
                        <p:inputText id="name" value="#{productViewBean.name}"
                                     label="Firstname" />
                        <h:outputLabel for="makerName" value="メーカー名 *" />
                        <p:selectOneMenu id="makerName"
                                         value="#{productViewBean.makerId}">
                            <f:selectItem itemLabel="メーカー名を選択しなさい" itemValue="0" />
                            <f:selectItems value="#{makerViewBean.makerList}" var="maker"
                                           itemLabel="#{maker.name}" itemValue="#{maker.id}" />
                        </p:selectOneMenu>
                        <h:outputLabel value="商品画像1"></h:outputLabel>
                        <h:inputFile value="#{productViewBean.file1}"/>
                        <h:outputLabel value="商品画像2"></h:outputLabel>
                        <h:inputFile  value="#{productViewBean.file2}" />
                        <h:outputLabel value="商品画像3"></h:outputLabel>
                        <h:inputFile value="#{productViewBean.file3}" />
                        <h:outputLabel value="商品画像4"></h:outputLabel>
                        <h:inputFile  value="#{productViewBean.file4}" />
                        <h:outputLabel for="content" value="商品説明" />
                        <p:inputTextarea rows="5" id="content"
                                         value="#{productViewBean.content}" />
                        <h:outputLabel value="表示順序" />
                        <p:inputText value="#{productViewBean.orderId}" />
                        <h:outputLabel value="非表示フラグ" />
                        <p:selectBooleanCheckbox value="#{productViewBean.deleteFlgBool}" />  
                        <f:facet name="footer">
                            <h:commandButton value="登録"
                                             action="#{productControllerBean.saveNew()}" style="margin:0">
                                <f:setPropertyActionListener target="#{productViewBean.flag}"
                                                             value="1" />
                            </h:commandButton>
                        </f:facet>
                    </p:panelGrid>
                </div>
            </div>
               <div align="right"><a href="#">▲このページのTOPへ</a></div>
        </h:form>
    </h:body>
</html>